package com.guanganren.service.impl;

import java.util.List;

import com.guanganren.db.dao.UserDao;
import com.guanganren.db.entity.User;
import com.guanganren.service.UserService;

public class UserServiceImpl implements UserService {

	private UserDao userDao;
	
	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	@Override
	public User getUser(String userId) {
		User user=null;
		try {
			user = userDao.getById(userId);
		} catch (Exception e) {
			
			e.printStackTrace();
		}
		return user;
	}

	@Override
	public List<User> getExistUser(String key, String value) throws Exception {
		try{
			List<User> list = userDao.getExistUser(key,value);
			return list;
		}catch(Exception ex){
			
			throw new Exception();
		}
		
	}

	@Override
	public void addUser(User bean) throws Exception {
		try{
			userDao.add(bean);
		}catch(Exception ex){
			throw new Exception();
		}
		
	}

}
